package com.java1412.config;

import com.java1412.resolver.ExcelViewResolver;
import com.java1412.resolver.HtmlViewResolver;
import com.java1412.resolver.PdfViewResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author java1412
 * @create 2021-05-14 14:13
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
    @Override
    protected void configureViewResolvers(ViewResolverRegistry registry) {
        registry.enableContentNegotiation(new PdfViewResolver());
        registry.enableContentNegotiation(new ExcelViewResolver());
        registry.enableContentNegotiation(new HtmlViewResolver());
        // 上面三个注册方法必须在此方法之上执行
        registry.enableContentNegotiation(false);
    }
}
